package com.yc.controller;

import brave.Span;
import brave.SpanCustomizer;
import brave.Tracer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: ZhouJianLong
 * @Date: 2024/07/11/18:48
 * @Description:
 */
@RestController
@RequestMapping("/")
public class IndexController {
    @Autowired
    Tracer tracer;
    @Autowired
    SpanCustomizer span;
    @GetMapping("/")
    ResponseEntity<String> index(){
//        Span newSpan = this.tracer.currentSpan();
//
////        newSpan.
//        try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(newSpan.start())) {
//            // ...
//            // You can tag a span
//            newSpan.tag("请求参数", "hello word");
//            // ...
//            // You can log an event on a span
//            newSpan.annotate("request");
//        }
//        finally {
//            // Once done remember to finish the span. This will allow collecting
//            // the span to send it to Zipkin
////            newSpan.finish();
//        }
        span.tag("请求参数","hellow word");
        return new ResponseEntity<>("111",HttpStatus.OK);
    }

}
